<!-- Breadcrums -->
<div class="container">
<ul id="breadcrumbs">
<?php foreach ($breadcrumbs as $key => $breadcrumb) { ?>
<?php if($key == 0) {  ?>
	<li><a href="<?php echo $breadcrumb['href']; ?>"><i class="icon-home"></i></a></li>
	<?php } else { ?>
	<li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
	<?php } ?>
	<?php } ?>
</ul>
</div>
<!-- Breadcrum -->
<div class="container">
<div id="main">
<div class="row">
<div class="span9">
	<div class="tabbable tabbable-bordered property-detail-listing">
		<div id="tabs" class="htabs">
			<a href="#tab-property-info">Property Info</a>
			<a href="#tab-property-map">Map</a>
			<a href="#tab-model-type">Model Type</a>
			<a href="#tab-developer-info">Developer Info</a>
		</div>
		<div id="tab-property-info" class="tab-content">
			<h1 class="page-header page-header-listing-detail"><?php echo $listingtoview['ProjectName']; ?></h1>
			<div class="row-fluid properties-rows">
				<div class="property">
					<div class="span7">
						<p class="sepH_a"><span class="propertytype lblproject">Property Type: <?php echo $listingtoview['PropertyType'] ?></span>
						</p>
						<p class="sepH_a location"><?php
						//Locality
						//initiation
						$locality = "";
						//check subarea
						if (!empty($listingtoview['Subarea'])) {
							$locality .= $listingtoview['Subarea'] . ", ";
						}
						
						//check location
						if (!empty($listingtoview['Location'])) {
							$locality .= $listingtoview['Location'] . ", ";
						}
						
						//check city
						if (!empty($listingtoview['City'])) {
							$locality .= $listingtoview['City'];
						}
						
						if (!empty($locality)) { ?> <span class="lblproject">Location: </span> <?php echo $locality; ?>
						<?php } ?></p>
						<p class="sepH_a propertytype"><span
							class="size_from lblproject lblproject">Size from </span><?php echo $listingtoview['Size_Min'] . ' ' . $listingtoview['SizeUnit']; ?>
						<span class="size_to lblproject">to </span><?php echo $listingtoview['Size_Max'] . ' ' . $listingtoview['SizeUnit']; ?>
						</p>
					</div>
					<div class="span5">
						<?php if(isset($Tenure) && !empty($Tenure)) { ?>
						<p class="sepH_a tenure">
							<span class="tenure lblproject">Tenure: </span>
							<?php echo $Tenure; ?>
						</p>
						<?php } ?>
						<p class="sepH_a description"><span
							class="year_of_completion lblproject">Year of completion: </span><?php echo $listingtoview['YearCompletion']; ?>
						</p>
					</div>
				</div>
			</div>
			<?php
			$listingtoview['media'] = $this->mdl_projectsmodel->getMediaForProjectDirectoryDetail($listingtoview['ID'], "Cover", 20);
			?>
			<div class="carousel property">
			<div class="preview"><?php if($listingtoview['media']) { ?> <?php
			$preview = "";
			foreach ($listingtoview['media'] as $key => $img) {
				if ($key == 0) {
					$preview = $this->config->item('HTTP_PRODIR_MEDIA_IMAGE') . $listingtoview['ID'] . '/' . str_replace(' ', '%20', $img->FileName . '-870x420' . $img->FileExtension);
					//get thumb for property map
					$thumb = $this->imagemodel->resize($img->FileName . $img->FileExtension, THUMB_IMAGE_WIDTH, THUMB_IMAGE_HEIGHT, HTTP_PROJECT_DIRECTORY_IMAGE . $listingtoview['ID'] . '/', $this->config->item('HTTP_PRODIR_MEDIA_IMAGE') . $listingtoview['ID'] . '/');
					break;
				}
			}
			?> <img src="<?php echo $preview; ?>" alt=""> <?php } else { ?> <img
				src="<?php echo $this->config->item('HTTP_IMAGE'); ?>tmp/property-large-1.jpg"
				alt=""> <?php } ?></div>
			<!-- /.preview -->
			
			<div class="content"><?php if($listingtoview['media']) { ?> <a
				class="carousel-prev" href="#">Previous</a> <a class="carousel-next"
				href="#">Next</a>
			<ul>
			<?php
			foreach ($listingtoview['media'] as $key => $img) {
				?>
				<li <?php if ($key == 0) { echo 'class="active"'; } ?>><img
					src="<?php echo $this->config->item('HTTP_PRODIR_MEDIA_IMAGE') . $listingtoview['ID'] . '/' . str_replace(' ', '%20', $img->FileName . '-870x420' . $img->FileExtension); ?>"
					alt="<?php echo $listingtoview['ProjectName']; ?>" />
				</li>
				<?php } ?>
			</ul>
				<?php } ?></div>
			<!-- /.content --></div>
			<!-- /.carousel -->
			
			<?php
			$description = $listingtoview['Description']; 
			if(isset($description) && strlen($description) > 8) { 
			?>
			<h2>Description</h2>
			<div class="row-fluid">
				<div class="span12">
					<div class="description">
						<?php echo html_entity_decode($description , ENT_QUOTES, 'UTF-8'); ?>
					</div>
				</div>
			</div>
			<?php } ?> 
			
			<?php if(isset($TypeOfUnits) && is_array($TypeOfUnits) && count($TypeOfUnits) > 0) { ?>
			<h2>Type Of Units</h2>
			<div class="row-fluid property-detail">
			<div class="span12">
			<ul class="span4">
			<?php foreach ($TypeOfUnits as $unit) { ?>
				<li class="checked"><?php echo $unit['Name']; ?></li>
				<?php } ?>
			</ul>
			</div>
			</div>
			<?php } ?>
		</div>
		<div id="tab-property-map" class="tab-content">
			<div id="map_project_directory"></div>
			<!-- /#property-map -->
			<input type="hidden" id="latListing" value="<?php echo $listingtoview['Latitude']; ?>" /> 
			<input type="hidden" id="lngListing" value="<?php echo $listingtoview['Longitude']; ?>" />
			<input type="hidden" id="areaListing" value="<?php echo number_format($listingtoview['Size_Min']) . ' ' . $listingtoview['SizeUnit']; ?>" />
			<input type="hidden" id="thumbListing" value="<?php echo $thumb; ?>" />
			<input type="hidden" id="titleListing" value="<?php echo $listingtoview['ProjectName']; ?>" />
		</div>
		<div id="tab-model-type" class="tab-content">
			<div class="row-fluid"><?php if(isset($modetype) && is_array($modetype) && count($modetype)> 0) { ?>
				<table class="table table-vam table-striped dataTable" id="dt_gal" aria-describedby="dt_gal_info">
					<thead>
						<tr role="row">
							<th class="sorting_disabled" role="columnheader" rowspan="1"
								colspan="1" aria-label="Image" style="width: 60px;">Image</th>
							<th class="sorting_asc" role="columnheader" tabindex="0"
								aria-controls="dt_gal" rowspan="1" colspan="1" aria-sort="ascending"
								aria-label="Name: activate to sort column descending"
								style="width: 201px;">Model Type</th>
							<th class="sorting" role="columnheader" tabindex="0"
								aria-controls="dt_gal" rowspan="1" colspan="1"
								aria-label="Size: activate to sort column ascending"
								style="width: 142px;">No. Of Units</th>
							<th class="sorting" role="columnheader" tabindex="0"
								aria-controls="dt_gal" rowspan="1" colspan="1"
								aria-label="Date: activate to sort column ascending"
								style="width: 372px;">Detail Description</th>
						</tr>
					</thead>
					<tbody role="alert" aria-live="polite" aria-relevant="all">
					<?php foreach ($modetype as $key => $type) { ?>
					<?php
					$is_row = ($key % 2 == 0 ? "odd" : "even");
					?>
						<tr class=<?php echo $is_row; ?>>
							<td style="width: 60px" class=" "><a href="gallery/Image01.jpg"
								title="Image 01" class="thumbnail"> <img alt=""
								src="<?php echo $type['href']; ?>" style="height: 50px; width: 50px">
							</a></td>
							<td><?php echo $type['ModelType']; ?></td>
							<td><?php echo $type['NoUnit']; ?></td>
							<td><?php echo $type['Description']; ?></td>
						</tr>
						<?php } ?>
					</tbody>
				</table>
				<?php } else { ?> <?php echo "<h3>The Model Type is not available</h3>"; ?>
				<?php } ?>
				</div>
		</div>
		<div id="tab-developer-info" class="tab-content">
			<div class="row-fluid">
				<?php if(isset($listingtoview['Developer'])) { ?>
				<p><?php echo $listingtoview['Developer']; ?></p>
				<?php } ?>
			</div>
		</div>
	</div>
</div>
<div class="sidebar span3">
	<?php $this->load->view('helpers/widgets/our-projects-agents.php'); ?> 
	<?php $this->load->view('helpers/widgets/similar-projects-directory.php'); ?>
</div>
</div>
</div>
</div>
